package com.derbysoft.lowcostadapter.commons.model;

/**
 * User: jason
 * Date: 2012-11-15
 */
public enum AvailabilityProvider {

    FROM_LOCAL_CACHE("local"),

    FROM_STORAGE("storage");

    private final String provider;

    private AvailabilityProvider(String provider) {
        this.provider = provider;
    }

    public static AvailabilityProvider from(String providerCode) {
        for (AvailabilityProvider availabilityProvider : AvailabilityProvider.values()) {
            if (availabilityProvider.provider.equals(providerCode)) {
                return availabilityProvider;
            }
        }
        return null;
    }

    public String getProvider() {
        return provider;
    }
}
